package com.lck.main.model;

import java.io.Serializable;

public class MyMessage implements Serializable {
    //消息的主题内容
    private Object content;

    //消息类型
    private Type type;

    //消息发起者阵营
    private int fromPlayer;

    public int getFromPlayer() {
        return fromPlayer;
    }

    public void setFromPlayer(int fromPlayer) {
        this.fromPlayer = fromPlayer;
    }

    public int getToPlayer() {
        return toPlayer;
    }

    public void setToPlayer(int toPlayer) {
        this.toPlayer = toPlayer;
    }

    //消息接收者的阵营
    private int toPlayer;

    //消息发起者
    private String from;

    //消息接收者
    private String to;

    public MyMessage(Object content, Type type, String from, String to) {
        this.content = content;
        this.type = type;
        this.from = from;
        this.to = to;
    }

    public MyMessage() {
    }

    @Override
    public String toString() {
        return "Message{" +
                "content=" + content +
                ", type=" + type +
                ", fromPlayer=" + fromPlayer +
                ", toPlayer=" + toPlayer +
                ", from='" + from + '\'' +
                ", to='" + to + '\'' +
                '}';
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public enum Type {
        LOGIN, //登录消息
        REG,   //注册
        FORGET, //忘记密码
        LIST,   //获取当前服务器登录的所有人
        FIGHT,  //发起对战
        FIGHT_SUCCESS,  //发起对战成功
        MOVE,   //移动
        EAT,    //吃子
        PEACE,  //求和
        SUCCESS, //成功
        FAIL,//发送失败
        SURRENDER,  //认输
        PEACE_SUCCESS, //求和成功
        PEACE_FAILURE  //求和失败
    }
}
